{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "from crewai import Agent\n",
    "from crewai_tools import SerperDevTool\n",
    "\n",
    "# Create an agent with all available parameters\n",
    "agent = Agent(\n",
    "    role=\"Senior Data Scientist\",\n",
    "    goal=\"Analyze and interpret complex datasets to provide actionable insights\",\n",
    "    backstory=\"With over 10 years of experience in data science and machine learning, \"\n",
    "              \"you excel at finding patterns in complex datasets.\",\n",
    "    llm=\"gpt-4\",  # Default: OPENAI_MODEL_NAME or \"gpt-4\" or my_llm\n",
    "    function_calling_llm=None,  # Optional: Separate LLM for tool calling   fucntion call时可以调用其它llm，这规避了deepseek不能call的缺点\n",
    "    memory=True,  # Default: True   记忆模式\n",
    "    verbose=False,  # Default: False    是否输出详细日志\n",
    "    allow_delegation=False,  # Default: False   是否允许代理\n",
    "    max_iter=20,  # Default: 20 iterations   最大迭代次数\n",
    "    max_rpm=None,  # Optional: Rate limit for API calls 最大调用频次\n",
    "    max_execution_time=None,  # Optional: Maximum execution time in seconds 最大执行时间\n",
    "    max_retry_limit=2,  # Default: 2 retries on error   最大重试次数\n",
    "    allow_code_execution=False,  # Default: False   是否允许代码执行\n",
    "    code_execution_mode=\"safe\",  # Default: \"safe\" (options: \"safe\", \"unsafe\")   代码执行模式\n",
    "    respect_context_window=True,  # Default: True   尊重上下文窗口。即Keep messages under context window size by summarizing.\n",
    "    use_system_prompt=True,  # Default: True    是否使用系统提示\n",
    "    tools=[SerperDevTool()],  # Optional: List of tools 使用工具\n",
    "    knowledge_sources=None,  # Optional: List of knowledge sources   知识库源\n",
    "    embedder=None,  # Optional: Custom embedder configuration   自定义embedder\n",
    "    system_template=None,  # Optional: Custom system prompt template    自定义系统提示模板\n",
    "    prompt_template=None,  # Optional: Custom prompt template   自定义提示模板\n",
    "    response_template=None,  # Optional: Custom response template   自定义响应模板\n",
    "    step_callback=None,  # Optional: Callback function for monitoring   监控回调函数\n",
    ")\n"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.12.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
